from multiprocessing import Pool,Manager
import time

def write(q):
    li = ["小红", "小明", "小黑"]
    for i in li:
        print(f"{i}被存进去了")
        q.put(i)

def read(q):
    # for i in range(q.qsize()):
    #     print(f"{q.get()}被拿出来了")
    while not q.empty():
        print(f"{q.get()}被拿出来了")

if __name__ == '__main__':
    p = Pool(3)
    q = Manager().Queue()
    p.apply_async(func=write,args=(q,))
    time.sleep(1)
    p.apply_async(func=read,args=(q,))
    p.close()
    p.join()
    print("结束了")